from selenium import webdriver
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome(service=Service('chromedriver.exe'))
driver.maximize_window()
driver.get('https://sahitest.com/demo/alertTest.htm')
# 单击右键
tu = driver.find_element(By.XPATH, '/html/body/form/input[3]')
ActionChains(driver).context_click(tu).perform()
time.sleep(20)
